package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.data.interfaces.IReport;
import com.itboye.mengwu.data.model.ReportModel;
import com.itboye.mengwu.data.repository.ReportRepository;

public class ReportPresenter extends BasePresenter implements
		IReport<ReportModel> {
	public static final String ReportSuccess = "_Report_success";
	public static final String ReportFail = "_Report_fail";

	public ReportPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(ReportModel model) {

		// TODO Auto-generated method stub
		IReport<ReportModel> report = new ReportRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(ReportSuccess);
						ReportPresenter.this.setChanged();
						ReportPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Error);
						result.setEventType(ReportFail);
						ReportPresenter.this.setChanged();
						ReportPresenter.this.notifyObservers(result);
					}
				});
		report.add(model);
	}

	@Override
	public void delete(ReportModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(ReportModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(ReportModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<ReportModel> queryYouHuiQuan(ReportModel model) {
		// TODO Auto-generated method stub
		return null;
	}

}
